fishbowl: Don't pop up popovers too early
authorMatthias Clasen <mclasen@redhat.com>
Fri, 24 May 2019 01:54:55 +0000 (01:54 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 28 May 2019 20:25:17 +0000 (20:25 +0000)
Wayland does not like this.

demos/gtk-demo/fishbowl.c

index e716a076583cbe3d8fed0f0b67ff6359147ccaa4..5eaadcde0f57fe31a67926ea3845085da8208166 100644 (file)
@@ -164,6 +164,12 @@ create_switch (void)
   return w;
 }
 
+static void
+mapped (GtkWidget *w)
+{
+  gtk_menu_button_popup (GTK_MENU_BUTTON (w));
+}
+
 static GtkWidget *
 create_menu_button (void)
 {
@@ -171,8 +177,9 @@ create_menu_button (void)
   GtkWidget *popover = gtk_popover_new (NULL);
 
   gtk_container_add (GTK_CONTAINER (popover), gtk_button_new_with_label ("Hey!"));
+  gtk_popover_set_autohide (GTK_POPOVER (popover), FALSE);
   gtk_menu_button_set_popover (GTK_MENU_BUTTON (w), popover);
-  gtk_menu_button_popup (GTK_MENU_BUTTON (w));
+  g_signal_connect (w, "map", G_CALLBACK (mapped), NULL);
 
   return w;
 }